package controlLayer;
import modelLayer.PersonContainer;
import modelLayer.Person;

/**
 * Write a description of class PersonCtr here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class PersonCtr
{
    PersonContainer container;
    
    public PersonCtr()
    {
        container = PersonContainer.getInstance();
    }

    public void createPerson(String name, String address, String zip, String city, String phone)
    {
       Person p = new Person(name, address, zip, city, phone);
       container.addPerson(p);
    }
    
    public Person findPerson(String phone)
    {
        return container.findPerson(phone);
    }
    
    public void updatePerson(Person person, String name, String address, String zip, String city, String phone)
    {
        person.setName(name);
        person.setAddress(address);
        person.setPostalCode(zip);
        person.setCity(city);
        person.setPhone(phone);
    }
    
    public void deletePerson(Person p)
    {
        container.removePerson(p);
    }
}
